package com.feonix.redis.client;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

public class ClusterClientTest {

	@SuppressWarnings({ "unchecked" })
	@Test
	public void test() {

		ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
				"spring-context-redis-cluster.xml");
		RedisTemplate<String, Object> redisTemplate = applicationContext.getBean("redisTemplate", RedisTemplate.class);
		RedisSerializer<String> stringRedisSerializer = new StringRedisSerializer();
		redisTemplate.setKeySerializer(stringRedisSerializer);
		redisTemplate.setValueSerializer(stringRedisSerializer);
		redisTemplate.setHashKeySerializer(stringRedisSerializer);
		redisTemplate.setHashValueSerializer(stringRedisSerializer);
		//redisTemplate.opsForValue().set("aa", "bb");
		String str = (String) redisTemplate.opsForValue().get("aa");
		System.out.println("=============" + str);

	}
}
